@extends("layouts.app")
@section('content')
<script src="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.fr.js"></script>
<link href="{{env('URL_SUB', '')}}/static/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <section class="content-header">
        <h1>
            京东券管理
        </h1>
        <ol class="breadcrumb">
            <li><a href="/dashboard"><i class="fa fa-dashboard"></i>家</a></li>
            <li><a href="#">京东券管理</a></li>
            <li class="active">京东券列表</li>
        </ol>
    </section>
    <section class="content">
        <div class='row'>
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">上传京东券</h3>
                        <div class="box-tools"></div>
                    </div>
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                        <form class="form-inline" role="form" method="POST" enctype="multipart/form-data">
                            {{ csrf_field()}}
                            <div class="form-group">
                                <input type="file" id="file" name="file" required>
                              </div>
                            <input type="submit" class="btn  btn-success" value="上传">&nbsp;
                        </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">搜索</h3>
                        <div class="box-tools"></div>
                    </div>
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                        <form class="form-inline" role="form" method="get" id="frmSearch">
                            <div class="form-group">
                                <input type="text" name="nickname" class="form-control input-sm" style="width:9em" placeholder="请输入昵称">
                            </div>&nbsp;
                            <div class="form-group">
                                <input type="text" name="openid" class="form-control input-sm" style="width:9em" placeholder="请输入openid">
                            </div>&nbsp;
                            <div class="form-group">
                                <input type="text" name="prizecode" class="form-control input-sm" style="width:9em" placeholder="请输入券号">
                            </div>&nbsp;
                            <div class="form-group">
                                <select class="form-control type form-inline" name="prizestate">
                                    <option value="">发放状态</option>
                                    <option value="0">未发放</option>
                                    <option value="1">已发放</option>
                                </select>
                            </div>&nbsp;
    <!--                        <div class="form-group">
                                <label class="sr-only" for="exampleInputEmail3"></label>
                                <input type="text" class="form-control pull-right datepicker" name="starttime" data-date-format="yyyy-mm-dd" placeholder="请输入开始日期">
                            </div>
                            &nbsp;
                            <div class="form-group">
                                <label class="sr-only" for="exampleInputEmail3"></label>
                                <input type="text" class="form-control pull-right datepicker" name="endtime" placeholder="请输入截止日期">
                            </div>-->
                            &nbsp;
                            <input type="submit" class="btn  btn-success" value="搜索">&nbsp;
                        </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
    <script>
//        $('.datepicker').datetimepicker({
//            autoclose: true,
//            format: 'yyyy-mm-dd',
//            minView : 2
//        });
        $(function(){
            var search = location.search.substring(1);
            if (search) {
                try {
                    var query = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');

                    $.each(query, function(k, v) {
                        $('[name=' + k + ']').val(v);
                    });
                } catch (e) {
                    console.log(e);
                }

            }
        })
    </script>
        <div class="row">
            <div class="col-sm-12">
                <div class="box">
                    <div class="box-header with-border box-danger">
                        <h3 class="box-title">列表</h3>
                    </div>

                <!-- /.box-body -->
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                            <div class="row">
                                <div class="col-sm-6"></div>
                                <div class="col-sm-6"></div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="example2" class="table table-bordered table-hover dataTable text-center" role="grid"
                                           aria-describedby="example2_info">
                                        <thead>
                                        <tr role="row">
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                券号
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                密码
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                面值
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                状态
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                发放时间
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                userID
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Browser: activate to sort column ascending">
                                                昵称
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Engine version: activate to sort column ascending">
                                                openid
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Platform(s): activate to sort column ascending">
                                                姓名
                                            </th>
                                            <th class="sorting col-sm-1" aria-controls="example2" rowspan="1"
                                                colspan="1"
                                                aria-label="Platform(s): activate to sort column ascending">
                                                手机号
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @foreach($list as $value)
                                            <tr role="row" class="odd">
                                                <td>{{$value->prizecode}}</td>
                                                <td>{{$value->prizepwd}}</td>
                                                <td>{{$value->prizetypeid}}</td>
                                                <td>@if($value->prizestate == '1')已发放@else未发放@endif</td>
                                                <td>{{$value->updated_at}}</td>
                                                <td>{{$value->userid}}</td>
                                                <td>{{$value->nickname}}</td>
                                                <td>{{$value->openid}}</td>
                                                <td>{{$value->capital_name}}</td>
                                                <td>{{$value->capital_phone}}</td>
                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            @include("layouts.page",['paginator'=>$list])
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <script src="{{env('URL_SUB', '')}}/bower_components/AdminLTE/plugins/iCheck/icheck.min.js"></script>
    <script src="{{env('URL_SUB', '')}}/bower_components/AdminLTE/plugins/iCheck/icheck.js"></script>
@endsection
